package com.taobao.api.request;

import java.util.Map;

import com.taobao.api.ApiRuleException;
import com.taobao.api.TaobaoRequest;
import com.taobao.api.internal.util.RequestCheckUtils;
import com.taobao.api.internal.util.TaobaoHashMap;
import com.taobao.api.response.HanoiRangesGetResponse;

/**
 * TOP API: taobao.hanoi.ranges.get request
 * 
 * @author auto create
 * @since 1.0, 2013-08-03 16:51:00
 */
public class HanoiRangesGetRequest implements TaobaoRequest<HanoiRangesGetResponse> {

  private Map<String, String> headerMap = new TaobaoHashMap();
  private TaobaoHashMap       udfParams;                      // add
                                                              // user-defined
                                                              // text parameters
  private Long                timestamp;

  /**
   * 分页时需要用。默认第一页。
   */
  private Long                currentPage;

  /**
   * 根据档案ID查询下面的值域信息
   */
  private Long                documentId;

  /**
   * 属性的唯一标识
   */
  private Long                id;

  /**
   * 取值范围的Key。可以和Document_ID搭配使用。
   */
  private String              key;

  /**
   * 分页时 每页显示的条数。最小1 最大30 默认10页
   */
  private Long                pageSize;

  public void setCurrentPage(Long currentPage) {
    this.currentPage = currentPage;
  }

  public Long getCurrentPage() {
    return this.currentPage;
  }

  public void setDocumentId(Long documentId) {
    this.documentId = documentId;
  }

  public Long getDocumentId() {
    return this.documentId;
  }

  public void setId(Long id) {
    this.id = id;
  }

  public Long getId() {
    return this.id;
  }

  public void setKey(String key) {
    this.key = key;
  }

  public String getKey() {
    return this.key;
  }

  public void setPageSize(Long pageSize) {
    this.pageSize = pageSize;
  }

  public Long getPageSize() {
    return this.pageSize;
  }

  public Long getTimestamp() {
    return this.timestamp;
  }

  public void setTimestamp(Long timestamp) {
    this.timestamp = timestamp;
  }

  public String getApiMethodName() {
    return "taobao.hanoi.ranges.get";
  }

  public Map<String, String> getTextParams() {
    TaobaoHashMap txtParams = new TaobaoHashMap();
    txtParams.put("current_page", this.currentPage);
    txtParams.put("document_id", this.documentId);
    txtParams.put("id", this.id);
    txtParams.put("key", this.key);
    txtParams.put("page_size", this.pageSize);
    if (this.udfParams != null) {
      txtParams.putAll(this.udfParams);
    }
    return txtParams;
  }

  public void putOtherTextParam(String key, String value) {
    if (this.udfParams == null) {
      this.udfParams = new TaobaoHashMap();
    }
    this.udfParams.put(key, value);
  }

  public Class<HanoiRangesGetResponse> getResponseClass() {
    return HanoiRangesGetResponse.class;
  }

  public void check() throws ApiRuleException {
    RequestCheckUtils.checkMaxValue(currentPage, 2147483647L, "currentPage");
    RequestCheckUtils.checkMinValue(currentPage, 1L, "currentPage");
    RequestCheckUtils.checkNotEmpty(documentId, "documentId");
    RequestCheckUtils.checkMaxValue(documentId, 9223372036854775807L, "documentId");
    RequestCheckUtils.checkMinValue(documentId, 1L, "documentId");
    RequestCheckUtils.checkMaxValue(id, 9223372036854775807L, "id");
    RequestCheckUtils.checkMinValue(id, 1L, "id");
    RequestCheckUtils.checkMaxLength(key, 50, "key");
    RequestCheckUtils.checkMaxValue(pageSize, 30L, "pageSize");
    RequestCheckUtils.checkMinValue(pageSize, 1L, "pageSize");
  }

  public Map<String, String> getHeaderMap() {
    return headerMap;
  }
}
